<?php
/////////////////////////////////////////////////////////////////////////////
// 
//
// workflow_system 
//
// workflow_copyright
// 
/////////////////////////////////////////////////////////////////////////////

/**
 * FILE_NAME : link.class.php   FILE_PATH : E:\www\\classes\application\channel_drag.class.php
 * 频道拖拽管理
 *
 * @copyright Copyright (c) 2007 - 2007 www.shopnc.net 
 * @author workflow Develop Team 
 * @package 
 * @subpackage 
 * @version Fri Feb 15 17:41:56 CST 2008
 */

class ChannelDragClass extends FrameWork {
	/**
	 * 店铺图片列表
	 *      
	 * @param  $condition  检索条件
	 * @param  $obj_page 分页
	 * @return array 数组形式的返回结果
	 */
	function listChannelDragPic($condition,&$obj_page){
		$conditionstr = $this->_conditionSearch($condition);
		$cd_array = $GLOBALS['db']->GetList($conditionstr, $obj_page, "channel_drag");
		return $cd_array;
	}

	/**
	 * 构造检索条件
	 *      
	 * @param  $condition  检索条件
	 * @return string 字符串形式的返回结果
	 */
	function _conditionSearch($condition){
		$condition_str = "";
		
		//风格
		if ($condition['cd_style'] != ''){
			$condition_str .= " and cd_style ='". $condition['cd_style'] ."'";
		}
		//颜色
		if ($condition['cd_color'] != ''){
			$condition_str .= " and cd_color ='". $condition['cd_color'] ."'";
		}
		//分类
		if ($condition['cd_type'] != ''){
			$condition_str .= " and cd_type ='". $condition['cd_type'] ."'";
		}
		if ($condition['order'] != ''){
			$condition_str .= $condition['order'];
		}
		
		return $condition_str;
	}

	/**
	 * 店铺拖拽添加图片
	 *      
	 * @param  $param 
	 * @return bool
	 */
	function addChannelDragPic($param){
		$arr = array();
		if (is_array($param)){
			foreach ($param as $k => $v){
				if (trim($v) != ''){
					$arr[$k] = $v;
				}
			}
		}
		return $GLOBALS['db']->InsertRow($arr,"channel_drag","cd_id");
	}

	/**
	 * 取指定信息
	 *     
	 * @param  $cd_id 店铺拖拽图片ID
	 * @return array 数组形式的返回结果
	 */
	function getOneChannelDragPic($cd_id){
		if (intval($cd_id) > 0) {
			return $GLOBALS['db']->GetOneRow($cd_id,'channel_drag','cd_id');
		}else {
			return false;
		}
	}

	/**
	 * 更新图片信息
	 *      
	 * @param  $input_param 更新参数
	 * @return bool 布尔类型的返回结果
	 */
	function updateChannelDragPic($input_param){
		if (is_array($input_param)){
			$arr = array();
			foreach ($input_param as $k => $v){
				$arr[$k] = $v;
			}
		}
		$insert_rs = $GLOBALS['db']->UpdateRow($arr['cd_id'],$arr, 'channel_drag', 'cd_id');
		return $insert_rs;
	}

	/**
	 * 删除
	 * 
	 * @param  $id 信息ID
	 * @return bool
	 */
	function delChannelDragPic($id){
		if (intval($id) > 0) {
			return $GLOBALS['db']->DeleOneRow(intval($id),'channel_drag','cd_id');
		}
		return false;
	}
}
?>